package com.hyt.it.ogt.data.service.kw.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.data.mapper.kw.ExamPaperPackageMapper;
import com.hyt.it.ogt.data.model.entity.kw.ExamPaperPackage;
import com.hyt.it.ogt.data.service.kw.IExamPaperPackageService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 考试-试卷包 服务实现类
 * </p>
 *
 * @author liuqi
 * @date 2022-06-07
 */
@Service
public class ExamPaperPackageServiceImpl extends BaseServiceImpl<ExamPaperPackageMapper, ExamPaperPackage> implements IExamPaperPackageService {

    @DS("kz")
    @Override
    public List<ExamPaperPackage> getPackagePaperDTO(String id, String version, String examId) {
        QueryWrapper<ExamPaperPackage> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda()
                .select(ExamPaperPackage::getPackageId,
                        ExamPaperPackage::getPackageVersion,
                        ExamPaperPackage::getPaperId,
                        ExamPaperPackage::getPaperVersion,
                        ExamPaperPackage::getPaperType)
                .eq(ExamPaperPackage::getPackageId, id)
                .eq(ExamPaperPackage::getPackageVersion, version)
                .eq(ExamPaperPackage::getExamId, examId)
//                .eq(ExamPaperPackage::getDelFlag, false)
                .orderByAsc(ExamPaperPackage::getSort);
        return list(queryWrapper);
    }

}
